<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link href="/hr_man/themes/bootstrap/easyui.css" rel="stylesheet">
<link href="/hr_man/themes/icon.css" rel="stylesheet">
<script type="text/javascript" src="/hr_man/js/jquery-1.9.1.js"></script>
<script type="text/javascript" src="/hr_man/js/jquery.easyui.min.js"></script>
<script type="text/javascript" src="/hr_man/js/easyui-lang-zh_CN.js"></script>
<title>Insert title here</title>
</head>
<script type="text/javascript">
	$(function() {
		$('#findEmpsCard').dialog('close');
		$('#searchEmp').searchbox({
			searcher : function(value, name) {
				var e_name = value;
				$("#em" ).css("display", "block"); 
				$('#empMsg').datagrid('reload', {
					searchName : e_name
				})
			},
		});
		$('#empMsg').datagrid({    
		    url:'${pageContext.request.contextPath}/findEmps',    
		    columns:[[    
		        {field:'checked',checkbox : true,name:'checkemp',width:100},    
		        {field : 'e_id',title : '员工编号',width : 100},    
		        {field:'e_name',title:'员工姓名',width:100,align:'center'} , 
		        {field:'e_sex',title:'员工姓别',width:100,align:'center'},
		    ]] ,
		    pagination : true,
		    toolbar : [  {
				iconCls : 'icon-search',
				text : '查看名片夹',
				handler : function() {
					var emps = $("#empMsg").datagrid('getSelections');
					if (emps.length != 1) {
						$.messager.confirm('提示', '请选择一条数据', function(r) {
							if (r) {
								$("#empMsg").datagrid('unselectAll');
							}
						})
					} else {	
						
							
						$.ajax({
							 type:'post',											   
							 url:'${pageContext.request.contextPath}/findcard',
							 data:{'card':emps[0].e_id},
							 dataType:"json",	
							 success:function(data){
								if(data.card_id!="0"){
									 $('#check').form('load',data)
									 $('#findEmpsCard').dialog('open');
								}
								else{  
									$.messager.confirm('消息','该用户未添加名片夹',function(r){    
									    
									}); 
								}
							 }
						})			
						
					}
				}
			} ],
			striped : true,
			rownumbers : true
		});  


	})
</script>
<body>
<input id="searchEmp" class="easyui-searchbox" style="width: 300px"
		data-options="prompt:'请输入员工姓名查询信息'"></input>
		<div id = "em" >
<table id="empMsg" ></table></div>
	<div id="findEmpsCard" class="easyui-dialog" title="名片夹"
		style="width: 400px; height: 450px;" data-options="modal:true">
		<form id="check" method="post">
			<div style="text-align: center;margin-top: 20px;margin-bottom: 20px; display: none;">
				<span>员工id</span> <input class="easyui-textbox" name="e_id"
					style="width: 100%;">
			</div>
			<div style="text-align: center;margin-top: 20px;margin-bottom: 20px">
				<span>姓名:</span> <input   name="e_name" style="width: 50; border: none;" readonly="readonly" />
			</div>
			<div style="text-align: center;margin-bottom: 20px">
				<span>年龄:</span> <input   name="e_age" style="width: 50;border: none;" readonly="readonly"/>
			</div>
			<div style="text-align: center;margin-bottom: 20px">
				<span>性别:</span> <input   name="e_sex" style="width: 50;border: none;" readonly="readonly"/>
			</div>
			<div style="text-align: center;margin-bottom: 20px">
				<span>公司:</span> <input  name="card_company" style="width: 50;border: none;" readonly="readonly"/>
			</div>
			<div style="text-align: center;margin-bottom: 20px">
				<span>地址:</span> <input   name="card_address" style="width: 50;border: none;" readonly="readonly"/>
			</div>
			<div style="text-align: center;margin-bottom: 20px">
				<span>电话:</span> <input   name="card_tel" style="width: 50;border: none;" readonly="readonly"/>
			</div>
			<div style="text-align: center;margin-bottom: 20px">
				<span>邮箱:</span> <input   name="card_email" style="width: 50;border: none;" readonly="readonly"/>
			</div>
		</form>
		</div>
</body>
</html>